﻿
using System;
using System.Collections.Generic;
using System.Text;

using YouHP.Utility;
using YouHP.BLL;
using YouHP.Model;
using System.Web;
using YouHP.Model.Group;

namespace YouHP.Pages.TreatmentHistory
{
    public class TreatmentSelect:BasePage
    {
        protected List<string> mPingYin = new List<string>();

        protected override void ShowPage()
        {
            base.ShowPage();
            if (ErrorCount > 0) return;

            HandleCommon();
            if (ErrorCount > 0) return;

            if (IsPost) HandlePost();
            else HandleGet();
        }


        protected List<TreatmentInfo> TreatmentDataList;
        protected List<DiseaseInfo> DiseaseLst;
        protected int TreatmentCount = 0;
        protected int TreatmentPageCount = 0;
        protected int TreatmentPageSize = 15;
        protected int TreatmentPageIndex = 1;
        protected string TreatmentPagingString;



        protected void HandleCommon()
        {
            this.AddLocation("治疗记录", "/TreatmentHistory/Index.aspx");
            this.AddLocation("选择治疗", "/TreatmentHistory/TreatmentSelect.aspx");
            DiseaseLst = DiseaseBLL.Instance.GetAllDiseaseByName("");
            this.SetTitle("选择治疗");

            for (char c = 'A'; c <= 'Z'; c++)
            {
                mPingYin.Add(c.ToString());
            }
        }

        protected void HandlePost()
        {

        }

        protected void HandleGet()
        {

            TreatmentPageIndex = RequestTools.GetQueryInt("page", 1);

            TreatmentSearchCondition cond = new TreatmentSearchCondition();
            cond.DiseaseId = RequestTools.GetQueryInt("dszid", 0);
            cond.DiseaseName = RequestTools.GetQueryString("dszname");
            cond.TreatmentName = RequestTools.GetQueryString("trmname");

            TreatmentDataList = TreatmentBLL.Instance.GetTreatmentList(
                TreatmentPageSize, TreatmentPageIndex,
                cond, out TreatmentCount);

            TreatmentPageCount = Utils.GetPageCount(TreatmentCount, TreatmentPageSize);

            string query = HttpContext.Current.Request.Url.Query;
            query = Utils.RemoveQueryItem(query, "page");

            TreatmentPagingString = this.GetPagingString(
                TreatmentPageIndex,
                TreatmentPageCount,
                "/TreatmentAll.aspx" + query, "page");


        }
    }
}